<Layout::MasterNavigation />
<Layout::MasterToolbar>
	<div class="zone-1">
		{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
			{{ui/ui-toolbar-button themed=true uppercase=false icon=constants.Icon.ArrowLeft label=model.document.name onClick=(action "onBack")}}
		{{/ui/ui-toolbar}}
	</div>
	<div class="zone-2" />
	<div class="zone-3" />
</Layout::MasterToolbar>

<Layout::Grid::Container>
	<Layout::Grid::Sidebar>
		<div class="sidebar-content">
			<div class="section">
				<div class="title">{{localize 'options'}}</div>
				<div class="list">
					<div class="item {{if (eq tab "general") "selected"}}" {{action "onTab" "general"}}>
						<i class={{concat "dicon " constants.Icon.Settings}} />
						<div class="name">{{localize 'settings'}}</div>
					</div>
					<div class="item {{if (eq tab "category") "selected"}}" {{action "onTab" "category"}}>
						<i class={{concat "dicon " constants.Icon.Category}} />
						<div class="name">{{localize 'categories'}}</div>
					</div>
					<div class="item {{if (eq tab "tag") "selected"}}" {{action "onTab" "tag"}}>
						<i class={{concat "dicon " constants.Icon.Tag}} />
						<div class="name">{{localize 'tags'}}</div>
					</div>
					{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
						{{#if model.permissions.documentApprove}}
							<div class="item {{if (eq tab "protection") "selected"}}" {{action "onTab" "protection"}}>
								<i class={{concat "dicon " constants.Icon.Locked}} />
								<div class="name">{{localize 'change_control'}}</div>
							</div>
						{{/if}}
						{{#if model.permissions.documentVersion}}
							<div class="item {{if (eq tab "versions") "selected"}}" {{action "onTab" "versions"}}>
								<i class={{concat "dicon " constants.Icon.Copy}} />
								<div class="name">{{localize 'versions'}}</div>
							</div>
						{{/if}}
					{{/if}}
				</div>
			</div>
		</div>
	</Layout::Grid::Sidebar>

	<Layout::Grid::Content>
		{{#if (eq tab "general")}}
			{{document/settings-general
				space=model.folder
				document=model.document
				permissions=model.permissions
				onSaveDocument=(action "onSaveDocument")}}
		{{/if}}

		{{#if (eq tab "category")}}
			{{document/settings-category
				space=model.folder
				document=model.document
				permissions=model.permissions
				onSaveDocument=(action "onSaveDocument")}}
		{{/if}}

		{{#if (eq tab "tag")}}
			{{document/settings-tag
				space=model.folder
				document=model.document
				permissions=model.permissions
				onSaveDocument=(action "onSaveDocument")}}
		{{/if}}

		{{#if (eq tab "protection")}}
			{{document/settings-protection
				space=model.folder
				spaces=model.folders
				document=model.document
				permissions=model.permissions
				onRefresh=(action "onRefresh")
				onSaveDocument=(action "onSaveDocument")}}
		{{/if}}

		{{#if (eq tab "versions")}}
			{{enterprise/settings-version
				space=model.folder
				spaces=model.folders
				document=model.document
				permissions=model.permissions
				versions=model.versions
				onRefresh=(action "onRefresh")
				onSaveDocument=(action "onSaveDocument")}}
		{{/if}}
	</Layout::Grid::Content>
</Layout::Grid::Container>
